package com.labichaoka.chaoka.ui.record;

import android.content.Context;
import android.graphics.Typeface;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.labichaoka.chaoka.R;
import com.labichaoka.chaoka.entity.OrderListResponse;

import java.util.List;


/**
 * Created by ruan on 2018/7/26.
 */

public class RepayOrderAdapter extends BaseQuickAdapter<OrderListResponse.DataBean.OrderRepaymentListBean,BaseViewHolder> {
    private Typeface iconfont;

    public RepayOrderAdapter(Context context, List<OrderListResponse.DataBean.OrderRepaymentListBean> data) {
        super(R.layout.item_order,data);
        iconfont= Typeface.createFromAsset(context.getAssets(), "iconfont/iconfont.ttf");
    }


    @Override
    protected void convert(BaseViewHolder helper, OrderListResponse.DataBean.OrderRepaymentListBean item) {
        helper.setText(R.id.title,item.getOrderSumAmount()+"元");
        helper.setText(R.id.total,item.getToLoadMoneyTime());
        helper.setText(R.id.status,item.getViewDto().getViewDesc());
        helper.setTypeface(R.id.next,iconfont);
        helper.getView(R.id.view).setVisibility(View.GONE);
        helper.getView(R.id.top).setVisibility(View.GONE);

        int viewCode = item.getViewDto().getViewCode();
        if (viewCode == 1 || viewCode == 4|| viewCode == 8) {
            helper.setTextColor(R.id.status, mContext.getResources().getColor(R.color.font_ff4340));
        }else if(viewCode==2||viewCode==5){
            helper.setTextColor(R.id.status, mContext.getResources().getColor(R.color.font_16d690));
        }else if(viewCode==3||viewCode==10){
            helper.setTextColor(R.id.status, mContext.getResources().getColor(R.color.mainColor));
        }else if(viewCode==6||viewCode==7||viewCode==9){
            helper.setTextColor(R.id.status, mContext.getResources().getColor(R.color.font_999999));
        }
    }

    @Override
    public void onViewRecycled(BaseViewHolder holder) {
        super.onViewRecycled(holder);
    }
}



